<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>智能通风系统 - 智慧粮库测控平台</title>
    <link rel="stylesheet" href="../css/theme.css" />
    <link rel="stylesheet" href="../css/common.css" />
    <link rel="stylesheet" href="../css/Intelligentventilation.css" />
    <link rel="stylesheet" href="../css/iconfont.css" />
    <link rel="stylesheet" href="../css/iconfont.ttf" />
    <link rel="stylesheet" href="../layui-v2.8.17/layui/css/layui.css" />
    <!-- VConsole 初始化 -->
    <script src="../lib/vconsole/vconsole.min.js"></script>
    <script src="../js/vconsole-init.js"></script>
    <script src="../layui-v2.8.17/layui/layui.js"></script>
    <script src="../lib/jquery.js"></script>
    <script src="../lib/echarts.min.js"></script>
    <script src="../js/warom-utils.js"></script>
    <script src="../js/android-interface.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/permissions.js"></script>
    <script src="../js/widgets.js"></script>
    <script src="../js/config.js"></script>
    <script src="../js/mock/mock-Intelligentventilation-data.js"></script>
    <script src="../js/mock/mock-operation-logs-data.js"></script>
    <script src="../js/operation-logs.js"></script>
    <script src="../js/Intelligentventilation.js"></script>
    <style>
        /* 全局样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Roboto", "PingFang SC", "Microsoft YaHei", sans-serif;
        }
        
        html, body {
            height: 100%;
            width: 100%;
            overflow: hidden;
        }
        
        body {
            background: linear-gradient(130deg, var(--theme-gradient-start) 0%, var(--theme-gradient-end) 100%);
            color: var(--theme-text-color);
            height: 100vh;
            width: 100vw;
            overflow: hidden;
        }
        
        /* 主要内容区域 */
        .app-content {
            display: flex;
            height: calc(100vh - 64px);
            margin-top: 5px;
            overflow: hidden;
        }
        
        /* 侧边栏样式 */
        .sidebar {
            width: 200px;
            background: var(--theme-card-bg);
            border-right: 1px solid var(--theme-card-border);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }
        
        .tab-header {
            display: flex;
            flex-direction: column;
            padding: 16px 0;
        }
        
        .tab {
            display: flex;
            align-items: center;
            padding: 12px 16px;
            cursor: pointer;
            transition: all 0.2s ease;
            color: rgba(255, 255, 255, 0.7);
            border-left: 3px solid transparent;
        }
        
        .tab:hover {
            background: rgba(255, 255, 255, 0.1);
            color: #FFFFFF;
        }
        
        .tab.active {
            background: rgba(255, 255, 255, 0.15);
            color: #FFFFFF;
            font-weight: 500;
        }
        
        .tab i {
            margin-right: 8px;
            font-size: 16px;
        }
        
        .tab span {
            font-size: 18px;
        }
        
        .tab-label {
            font-size: 16px;
            font-weight: bold;
        }
        
        /* 内容区域 */
        .content-area {
            flex: 1;
            padding: 16px;
            overflow-y: auto; /* 确保内容可滚动 */
        }
        
        .tab-content {
            display: none;
            height: 100%;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .tab-content.active {
            display: block;
            opacity: 1;
        }
        
        /* 加载占位符样式 */
        .empty-data {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            min-height: 200px;
            width: 80%;
            max-width: 400px;
            margin: 40px auto;
            background-color: var(--theme-card-bg);
            border: 1px solid var(--theme-card-border);
            border-radius: 8px;
            padding: 30px 20px;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            text-align: center;
        }
        
        .empty-data i {
            font-size: 48px;
            color: #FFB800;
            margin-bottom: 20px;
        }
        
        .empty-data p {
            color: #FFFFFF;
            font-size: 16px;
            font-weight: 500;
        }
        
        /* 响应式调整 */
        @media screen and (max-width: 768px) {
            .sidebar {
                width: 160px;
            }
            
            .tab {
                padding: 10px 12px;
            }
            
            .tab span {
                font-size: 18px;
            }
            
            .content-area {
                padding: 12px;
            }
        }
        
        /* 空数据容器样式 */
        .empty-container {
            justify-content: center !important;
            align-items: center !important;
        }
        
        /* 控制面板样式 */
        .control-panel {
            display: flex;
            flex-direction: column;
            height: 100%;
        }
        
        /* 设备卡片容器 */
        .cards-container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            justify-content: flex-start;
            align-items: flex-start;
            min-height: 300px;
            z-index: 999;
            padding-bottom: 20px; /* 添加底部内边距 */
        }
        
        /* 确保按钮可见 */
        .device-actions {
            visibility: visible !important;
            display: flex !important;
        }
        
        /* 确保按钮文本可见 */
        .device-actions button {
            overflow: visible !important;
            white-space: nowrap !important;
        }
    </style>
</head>

<body>
    <!-- 公共头部 -->
    <header class="common-header"></header>

    <main class="app-content">
        <div class="sidebar">
            <div class="tab-header">
                <div class="tab active" data-tab="tab1">
                    <i class="layui-icon layui-icon-set"></i>
                    <span class="tab-label">自然通风窗</span>
                </div>
                <div class="tab" data-tab="tab2">
                    <i class="layui-icon layui-icon-template-1"></i>
                    <span class="tab-label">轴流通风窗</span>
                </div>
                <div class="tab" data-tab="tab3">
                    <i class="layui-icon layui-icon-spread-left"></i>
                    <span class="tab-label">环流通风窗</span>
                </div>
                <div class="tab" data-tab="tab4">
                    <i class="layui-icon layui-icon-engine"></i>
                    <span class="tab-label">轴流风机</span>
                </div>
                <div class="tab" data-tab="tab5">
                    <i class="layui-icon layui-icon-console"></i>
                    <span class="tab-label">环流风机</span>
                </div>
            </div>
        </div>

        <div class="content-area">
            <!-- 静态Tab内容 -->
            <!-- 自然通风窗 -->
            <div id="tab1" class="tab-content active">
                <div class="control-panel">
                    <div class="global-actions">
                        <button type="button" class="layui-btn layui-btn-normal btn-action" data-type="NATURAL_WINDOW" data-action="on" data-permission="control_device">
                            <i class="layui-icon layui-icon-play"></i> 全部开启
                        </button>
                        <button type="button" class="layui-btn layui-btn-danger btn-action" data-type="NATURAL_WINDOW" data-action="off" data-permission="control_device">
                            <i class="layui-icon layui-icon-close"></i> 全部关闭
                        </button>
                        <button type="button" class="layui-btn layui-btn-primary btn-goto-settings">
                            <i class="layui-icon layui-icon-set"></i> 前往设置
                        </button>
                    </div>
                    
                    <!-- 设备卡片容器 -->
                    <div class="cards-container">
                        <!-- 内容将由JavaScript动态填充 -->
                    </div>
                </div>
            </div>
            
            <!-- 轴流通风窗 -->
            <div id="tab2" class="tab-content">
                <div class="control-panel">
                    <div class="global-actions">
                        <button type="button" class="layui-btn layui-btn-normal btn-action" data-type="AXIAL_WINDOW" data-action="on" data-permission="control_device">
                            <i class="layui-icon layui-icon-play"></i> 全部开启
                        </button>
                        <button type="button" class="layui-btn layui-btn-danger btn-action" data-type="AXIAL_WINDOW" data-action="off" data-permission="control_device">
                            <i class="layui-icon layui-icon-close"></i> 全部关闭
                        </button>
                        <button type="button" class="layui-btn layui-btn-primary btn-goto-settings">
                            <i class="layui-icon layui-icon-set"></i> 设置
                        </button>
                    </div>
                    
                    <!-- 设备卡片容器 -->
                    <div class="cards-container">
                        <!-- 内容将由JavaScript动态填充 -->
                    </div>
                </div>
            </div>
            
            <!-- 环流通风窗 -->
            <div id="tab3" class="tab-content">
                <div class="control-panel">
                    <div class="global-actions">
                        <button type="button" class="layui-btn layui-btn-normal btn-action" data-type="CIRCULATION_WINDOW" data-action="on" data-permission="control_device">
                            <i class="layui-icon layui-icon-play"></i> 全部开启
                        </button>
                        <button type="button" class="layui-btn layui-btn-danger btn-action" data-type="CIRCULATION_WINDOW" data-action="off" data-permission="control_device">
                            <i class="layui-icon layui-icon-close"></i> 全部关闭
                        </button>
                        <button type="button" class="layui-btn layui-btn-primary btn-goto-settings">
                            <i class="layui-icon layui-icon-set"></i> 设置
                        </button>
                    </div>
                    
                    <!-- 设备卡片容器 -->
                    <div class="cards-container">
                        <!-- 内容将由JavaScript动态填充 -->
                    </div>
                </div>
            </div>
            
            <!-- 轴流风机 -->
            <div id="tab4" class="tab-content">
                <div class="control-panel">
                    <div class="global-actions">
                        <button type="button" class="layui-btn layui-btn-normal btn-action" data-type="AXIAL_FAN" data-action="on" data-permission="control_device">
                            <i class="layui-icon layui-icon-play"></i> 全部开启
                        </button>
                        <button type="button" class="layui-btn layui-btn-danger btn-action" data-type="AXIAL_FAN" data-action="off" data-permission="control_device">
                            <i class="layui-icon layui-icon-close"></i> 全部关闭
                        </button>
                        <button type="button" class="layui-btn layui-btn-primary btn-goto-settings">
                            <i class="layui-icon layui-icon-set"></i> 设置
                        </button>
                    </div>
                    
                    <!-- 设备卡片容器 -->
                    <div class="cards-container">
                        <!-- 内容将由JavaScript动态填充 -->
                    </div>
                </div>
            </div>
            
            <!-- 环流风机 -->
            <div id="tab5" class="tab-content">
                <div class="control-panel">
                    <div class="global-actions">
                        <button type="button" class="layui-btn layui-btn-normal btn-action" data-type="CIRCULATION_FAN" data-action="on" data-permission="control_device">
                            <i class="layui-icon layui-icon-play"></i> 全部开启
                        </button>
                        <button type="button" class="layui-btn layui-btn-danger btn-action" data-type="CIRCULATION_FAN" data-action="off" data-permission="control_device">
                            <i class="layui-icon layui-icon-close"></i> 全部关闭
                        </button>
                        <button type="button" class="layui-btn layui-btn-primary btn-goto-settings">
                            <i class="layui-icon layui-icon-set"></i> 设置
                        </button>
                    </div>
                    
                    <!-- 设备卡片容器 -->
                    <div class="cards-container">
                        <!-- 内容将由JavaScript动态填充 -->
                    </div>
                </div>
            </div>
        </div>
    </main>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 加载保存的主题
            loadSavedTheme();
            // 初始化公共头部
            initCommonHeader('智能通风系统', true);
            
        });
    </script>
</body>

</html>